﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sc="clr-namespace:SilverlightContrib.Controls;assembly=SilverlightContrib.Controls"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">

    <Style TargetType="sc:ColorPicker">
        <Setter Property="Width" Value="200" />
        <Setter Property="Height" Value="200" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="sc:ColorPicker">
                    <Grid x:Name="RootElement">
                        <Canvas>
                            <Rectangle x:Name="HueMonitor" Canvas.ZIndex="1" Canvas.Left="0" Canvas.Top="0" Width="20" Height="180" >
                                <Rectangle.Fill>
                                    <LinearGradientBrush StartPoint ="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0.00" Color="#ffff0000"/>
                                        <GradientStop Offset="0.17" Color="#ffffff00"/>
                                        <GradientStop Offset="0.33" Color="#ff00ff00"/>
                                        <GradientStop Offset="0.50" Color="#ff00ffff"/>
                                        <GradientStop Offset="0.66" Color="#ff0000ff"/>
                                        <GradientStop Offset="0.83" Color="#ffff00ff"/>
                                        <GradientStop Offset="1.00" Color="#ffff0000"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Canvas x:Name="HueSelector" Canvas.ZIndex="1" IsHitTestVisible="False" Height="8" Canvas.Left="0" Canvas.Top="-4">
                                <Path Width="5" Height="8" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FF000000" Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z " />
                                <Path Width="5" Height="8" Canvas.Top="8" Canvas.Left="20" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FF000000" Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z ">
                                    <Path.RenderTransform>
                                        <RotateTransform Angle="180" />
                                    </Path.RenderTransform>
                                </Path>
                            </Canvas>
                            <Canvas Canvas.Top="0" Canvas.Left="20" Canvas.ZIndex="1">
                                <Rectangle x:Name="ColorSample" Width="180" Height="180" Fill="Red"></Rectangle>
                                <Rectangle x:Name="WhiteGradient" IsHitTestVisible="False" Width="180" Height="180">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                            <GradientStop Offset="0" Color="#ffffffff"/>
                                            <GradientStop Offset="1" Color="#00ffffff"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle x:Name="BlackGradient" IsHitTestVisible="False" Width="180" Height="180">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush StartPoint="0,1" EndPoint="0, 0">
                                            <GradientStop Offset="0" Color="#ff000000"/>
                                            <GradientStop Offset="1" Color="#00000000"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Canvas x:Name="SampleSelector" IsHitTestVisible="False" Width="10" Height="10" Canvas.Left="100" Canvas.Top="96">
                                    <Ellipse Width="10" Height="10" StrokeThickness="3" Stroke="#FFFFFFFF"/>
                                    <Ellipse Width="10" Height="10" StrokeThickness="1" Stroke="#FF000000"/>
                                </Canvas>
                            </Canvas>
                            <Canvas Canvas.Top="180" Canvas.Left="0" Canvas.ZIndex="0">
                                <Rectangle x:Name="SelectedColorView" Width="100" Height="20" Canvas.Left="100" Fill="Black" />
                                <TextBox x:Name="TbHexValue" Visibility="Visible" Width="100" Text="#FF0000" FontFamily="monospace" FontSize="11" Canvas.Top="0" Canvas.Left="0"  Height="20" />
                            </Canvas>
                        </Canvas>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>